{% if parent.defined_template_name -%}
{{ "{% extends '" }}{{ parent.defined_template_name }}{{ "' %}" }}
{%- else -%}
{{ "{% extends '" + app_name + "/_base.html' %}" }}
{%- endif %}
{%- if page.get_template_libs() %}

{{ "{% load " }}{{ ' '.join(page.get_template_libs()) }}{{ " %}" }}
{%- endif %}
{% for area, blocks in page.get_blocks().items() -%}
{{ "{% block " }}{{ area }}{{ " %}" }}
{% for block in blocks -%}
{% if block.name == '..' -%}
{{ super() }}
{%- else -%}
{{ block.render(area=area, index=loop.index) }}
{%- endif %}
{%- endfor %}
{{ "{% endblock %}" }}
{%- endfor %}

{% if page.react_client %}
{{ "{% block js %}{{ block.super }}" }}
<script>
{% for page_name in page.react_pages.keys() -%}
R.renderClient(R.{{ page_name }}Reducer, R.{{ page_name }}, {{ '{{ react_state|safe }}' }}, document.getElementById('reactEl-{{ page_name }}'), {{ page.react_server|tojson }});
{%- endfor %}
</script>
{{ "{% endblock %}" }}
{% endif %}